package com.db.customer;

import java.sql.*;
import java.util.*;
import java.io.*;

import javax.annotation.Resource;

import com.ibatis.common.resources.*;
import com.ibatis.sqlmap.client.*;

public class CustomerDAO {
	public static SqlMapClient sqlmap;
	static {
		try {
			Reader reader = Resources
					.getResourceAsReader("com/db/config/SqlMapConfig.xml");
			sqlmap = SqlMapClientBuilder.buildSqlMapClient(reader);
		} catch (Exception ex) {
			System.out.println("static : " + ex.getMessage());
		}
	}

	public static List customerAllData(int type) throws Exception {
		return sqlmap.queryForList("customerAllData", type);
	}

	public static CustomerVO customerFind(int no) throws Exception {
		return (CustomerVO) sqlmap.queryForObject("customerFind", no);
	}

	public static void customerInsert(CustomerVO vo) throws Exception {
		sqlmap.insert("customerInsert", vo);
	}

	public static void customerDelete(int no) throws SQLException {
		sqlmap.delete("customerDelete", no);
	}

	public static void customerUpdate(int no) throws SQLException {
		sqlmap.update("customerUpdate", no);
	}
}
